<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./http.js"></script>
    <style>
        html,body{
            width: 100%;
            height: 100%;
        }
        *{
            padding: 0;
            margin: 0;
        }
        body{
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .box{
            width: 400px;
            height: 600px;
            background-color: #fa0;
            display: flex;
            flex-direction: column;
            justify-content: space-evenly;
            align-content: space-around;
        }
        .p1 input{
            width: 300px;
            height: 40px;
            border-radius: 10px;
            border: 0;
            outline: 0;
        }
        .p2 input{
            width: 300px;
            height: 40px;
            border-radius: 10px;
            border: 0;
            outline: 0;
        }
        .p1{
            font-size: 20px;
        }
        .p2{
            font-size: 20px;
        }
        .p3{
            text-align: center;
        }
         button{
            width: 300px;
            line-height: 40px;
            text-align: center;
            color: #000;
            outline: 0;
            border: 0;

        }
    </style>
</head>
<body>
    <div class="box">
        <p class="p1">账号：<input type="text" class="acc"></p>
        <p class="p2">密码：<input type="password" class="pwd"></p>
        <p class="p3"><button class="btn">立即注册</button></p>
    </div>
    <script>
        let acc = document.querySelector(".acc")
        let pwd = document.querySelector(".pwd")
        let btn = document.querySelector(".btn")
        btn.addEventListener("click",function(){
            let obj = {
            account:`${acc.value}`,
            password:`${pwd.value}`
        }
        http.ajax({
            type:"post",
            url:"http://139.9.177.51:8099/users/login",
            data:obj,
            success:function(data){
                if(data.status===0){
                    alert("登录成功")
                }else{
                    alert("登录失败")
                }
            }
        })
        })
        </script>
</body>
</html>